﻿using System;
using System.Collections.Generic;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;
using Jayden.Dll.Web.HtmlControls.Interfaces;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Style : HtmlElement, WithType
	{
		public Style() : base(StyleDescription.Instance) { }

		public string Type { get { return this["type"]; } set { this["type"] = value; } }
		public string Media { get { return this["media"]; } set { this["media"] = value; } }
		public bool Scoped { get { return GetAttributeBool("scoped"); } set { SetAttribute("scoped", value); } }
	}
	public class StyleDescription : HtmlElementDescription
	{
		public static readonly StyleDescription Instance = new StyleDescription();
		private StyleDescription() : base("style", HtmlVersion.Html4, false, true) { }
		public override string Description { get { return "allows style information to be embedded in documents."; } }
		public override Type ControlType { get { return typeof(Style); } }
		public override bool IsMetaDataElement { get { return true; } }
		public override bool AllowFlowContent { get { return false; } }
		public override bool AllowPhrasingContent { get { return false; } }
		public override IEnumerable<HtmlElementDescription> PermittedParents
		{
			get
			{
				yield return DivDescription.Instance;
				yield return NoScriptDescription.Instance;
				yield return ArticleDescription.Instance;
				yield return SectionDescription.Instance;
				yield return AsideDescription.Instance;
			}
		}
	}
}
